﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using SmallSoft.Language.View.Interface;
using SmallSoft.Language.Model.Interface;
using SmallSoft.Language.Presenter.Interface;
using SmallSoft.Language.Presenter.Factory;

namespace SmallSoft.Language.View
{
    public partial class WordNotifyView : UserControl,IWordNotifyView
    {
        #region
        private String word;
        private String wordSpell;
        private IWordNotifyPresenterBase presenter;
        #endregion
        public WordNotifyView()
        {
            InitializeComponent();

            presenter = WordNotifyPresenterFactory.GetWordNotifyPresenter(eWordNotifyPresenter.WP_WORDNOTIFY);
            presenter.NotifyView = this;
        }

        #region IWordNotifyBase Members

        public void InitValue()
        {
            throw new NotImplementedException();
        }        

        public string Word
        {
            get
            {
                return word;
            }
            set
            {
                word = value;
            }
        }

        public string WordPell
        {
            get
            {
                return wordSpell;
            }
            set
            {
                WordPell = value;
            }
        }

        #endregion

        #region IWordNotifyView Members


        public void SetParent(Control parent)
        {
            this.Parent = parent;
        }

        #endregion


        public void SetModel(IWordModel model)
        {
             if (presenter!=null)
             {
                 presenter.ApplyData(model);
             }
        }

        public void ApplyModelToView(IWordModel model)
        {
            labelword.Text = model.Word;
            labelspell.Text = model.WordMean;
        }
    }
}
